#ifndef __BSP_LVD_H__
#define __BSP_LVD_H__


#include "config.h"
#include "hc32_ddl.h"


/* C binding of definitions if building with C++ compiler */
#define  PVD2_INT             0
#define  PVD2_NMI             1

#define  PVD2_WKUP            1
#define  NMI_WKUP             0
#define  PIN_WKUP             0


#define BSP_LVD_PORT		(PortB)
#define BSP_LVD_PIN			(Pin02)
#define BSP_LVD_IRQn    (INT_PORT_EIRQ2)


#define PVD_IRQn        (Int141_IRQn)



#define BSP_LVD_InLow()   (PORT_GetBit(BSP_LVD_PORT,BSP_LVD_PIN) == Reset)
#define BSP_LVD_InHigh()  (PORT_GetBit(BSP_LVD_PORT,BSP_LVD_PIN) == Set)


typedef  struct
{
	uint8   sta;
	uint16  cntLowTime;
	uint16  cntHighTime;
}PW_CTRL;


extern  PW_CTRL  PwCtrl;


/*******************************************************************************
  Global function prototypes (definition in C source)
 ******************************************************************************/
void BspLvdInit(void);
void PowerDown(void);

void BspDownClk(void);



#endif 

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/
